import 'package:storage/generated/json/base/json_convert_content.dart';
import 'package:storage/model/user_name_entity.dart';

UserNameEntity $UserNameEntityFromJson(Map<String, dynamic> json) {
  final UserNameEntity userNameEntity = UserNameEntity();
  final int? goodsId = jsonConvert.convert<int>(json['goodsId']);
  if (goodsId != null) {
    userNameEntity.goodsId = goodsId;
  }
  final String? goodsName = jsonConvert.convert<String>(json['goodsName']);
  if (goodsName != null) {
    userNameEntity.goodsName = goodsName;
  }
  final String? goodsSpecification = jsonConvert.convert<String>(
      json['goodsSpecification']);
  if (goodsSpecification != null) {
    userNameEntity.goodsSpecification = goodsSpecification;
  }
  final int? goodsType = jsonConvert.convert<int>(json['goodsType']);
  if (goodsType != null) {
    userNameEntity.goodsType = goodsType;
  }
  final String? warehouseInTime = jsonConvert.convert<String>(
      json['warehouseInTime']);
  if (warehouseInTime != null) {
    userNameEntity.warehouseInTime = warehouseInTime;
  }
  final String? lastWarehouseOutTime = jsonConvert.convert<String>(
      json['lastWarehouseOutTime']);
  if (lastWarehouseOutTime != null) {
    userNameEntity.lastWarehouseOutTime = lastWarehouseOutTime;
  }
  final int? inventoryQuantity = jsonConvert.convert<int>(
      json['inventoryQuantity']);
  if (inventoryQuantity != null) {
    userNameEntity.inventoryQuantity = inventoryQuantity;
  }
  final double? goodsPrice = jsonConvert.convert<double>(json['goodsPrice']);
  if (goodsPrice != null) {
    userNameEntity.goodsPrice = goodsPrice;
  }
  final double? lastEditPrice = jsonConvert.convert<double>(
      json['lastEditPrice']);
  if (lastEditPrice != null) {
    userNameEntity.lastEditPrice = lastEditPrice;
  }
  return userNameEntity;
}

Map<String, dynamic> $UserNameEntityToJson(UserNameEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['goodsId'] = entity.goodsId;
  data['goodsName'] = entity.goodsName;
  data['goodsSpecification'] = entity.goodsSpecification;
  data['goodsType'] = entity.goodsType;
  data['warehouseInTime'] = entity.warehouseInTime;
  data['lastWarehouseOutTime'] = entity.lastWarehouseOutTime;
  data['inventoryQuantity'] = entity.inventoryQuantity;
  data['goodsPrice'] = entity.goodsPrice;
  data['lastEditPrice'] = entity.lastEditPrice;
  return data;
}

extension UserNameEntityExtension on UserNameEntity {
  UserNameEntity copyWith({
    int? goodsId,
    String? goodsName,
    String? goodsSpecification,
    int? goodsType,
    String? warehouseInTime,
    String? lastWarehouseOutTime,
    int? inventoryQuantity,
    double? goodsPrice,
    double? lastEditPrice,
  }) {
    return UserNameEntity()
      ..goodsId = goodsId ?? this.goodsId
      ..goodsName = goodsName ?? this.goodsName
      ..goodsSpecification = goodsSpecification ?? this.goodsSpecification
      ..goodsType = goodsType ?? this.goodsType
      ..warehouseInTime = warehouseInTime ?? this.warehouseInTime
      ..lastWarehouseOutTime = lastWarehouseOutTime ?? this.lastWarehouseOutTime
      ..inventoryQuantity = inventoryQuantity ?? this.inventoryQuantity
      ..goodsPrice = goodsPrice ?? this.goodsPrice
      ..lastEditPrice = lastEditPrice ?? this.lastEditPrice;
  }
}